--[[
Inherits from Optimizer.Class "Class"
if your unfamiliar with lua OOP concepts
see http://lua-users.org/wiki/ObjectOrientedProgramming

]]--

Optimizer.Class.Warrior = Optimizer.inheritsFrom(Optimizer.Class);

function Optimizer.Class.Warrior:initLib()
    local bt = Optimizer.Spell:new();
    bt.name = "Blutdurst";
    bt.cooldown = 5;
    
    local ww = Optimizer.Spell:new();
    ww.name = "Wirbelwind";
    ww.cooldown = 8;
    ww.wwHits = 0;
    ww.wwCastT = 0;
    -- "hook" another function to the spell_damage event
    -- whirlwind requires a different handling cause every target that gets hit 
    -- triggers a spell_damage combatlogevent
    ww.Events["SPELL_DAMAGE"] = function(op) op:Cast_WW() end;
    
    local hw = Optimizer.Spell:new();
    hw.name = "Heldenhafter Wurf";
    hw.cooldown = 60;

    self:AddSpell(ww);
    self:AddSpell(bt);
    self:AddSpell(hw);
end

function Optimizer.Spell:Cast_WW(...)
    local sec = arg1;
    if sec-self.wwCastT > 1 or self.wwCastT == 0 then
        self.wwCastT = sec;
        self.wwHits = 1;
        self:Cast(...);
    else
        self.wwHits = self.wwHits + 1;
    end
end

